// 以前 token 令牌，如果存到了本地，每一次都写这么长，太麻烦
// localStorage.setItem(键， 值)
// localStorage.getItem(键)
// localStorage.removeItem(键)

const KEY = 'my-token-vant-mobile'
const k = 'username'

// 直接用按需导出，可以导出多个
// 但是按需导出，导入时必须 import { getToken } from '模块名导入'
// 获取
export const getToken = () => {
  return localStorage.getItem(KEY)
}

// 设置
export const setToken = (newToken) => {
  localStorage.setItem(KEY, newToken)
}

// 删除
export const delToken = () => {
  localStorage.removeItem(KEY)
}
// 设置用户名
export const setUsername = (name) => {
  localStorage.setItem(k, name)
}
// 获取用户名
export const getUsername = () => {
  return localStorage.getItem(k)
}

// 获取本地 把城市
export const getcityToken = () => {
  return localStorage.getItem('cityname')
}

// 存储本地城市名字
export const setcityToken = (name) => {
  return localStorage.setItem('cityname', name)
}
// 存储本地城市value值
export const setcityvalueToken = (value) => {
  return localStorage.setItem('cityvalue', value)
}

// 获取本地城市value值
export const getCityValueToken = () => {
  return localStorage.getItem('cityvalue')
}
